<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      rel="stylesheet"
      href="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/styles/pojoaque.min.css"
    />
    <script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/highlight.min.js"></script>
    <script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/languages/css.min.js"></script>
  </head>
  <body>
    <pre>
      <code id="code">  
      * {
        margin: 0;
        padding: 0;
        background: #000;
      }
      
      html,
      body {
        width: 100%;
        height: 100%;
      }
        </code>
      </pre>
    <script>
      let code = document.getElementById("code");
      console.log(hljs);
      hljs.highlightElement(code, {
        language: "css",
      });
      /* 加载 */
      // const codes = {
      //   lang: "css",
      //   content: ` * {
      //   margin: 0;
      //   padding: 0;
      //   background: #0001;
      // }
      
      // html,
      // body {
      //   width: 100%;
      //   height: 100%;
      // }`,
      // };
      // const result = hljs.highlight(codes.content, { language: codes.lang });
      // const codeArea = document.getElementById("code");
      // codeArea.innerHTML = result.value;
      // codeArea.className = `hljs lang=${result.language}`;
      // console.log(result);
    </script>
  </body>
</html>
